/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.vistas;

import com.mycompany.Controlador.GenericController;
import com.mycompany.entidades.Articulo;
import com.mycompany.entidades.Cliente;
import com.mycompany.entidades.Detallefactura;
import com.mycompany.entidades.Diario;
import com.mycompany.entidades.Factura;
import com.mycompany.entidades.Ingreso;
import com.mycompany.entidades.Serie;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.UIManager;
import util.CNumeros;

/**
 *
 * @author johnny
 */
public class VFactura extends javax.swing.JFrame {

    /**
     * Creates new form VFactura
     */
    Articulo objArt;
    GenericController<Articulo> controlArticulo = new GenericController();
    MiModelo modelo = new MiModelo();
    GenericController<Factura> controladorFactura = new GenericController();
    GenericController<Serie> controladorSerie = new GenericController();
    List<Detallefactura> listaDetalle = new ArrayList<Detallefactura>();
    List<Articulo> listaArticulo = new ArrayList<Articulo>();
    Cliente cli;
    JTextField texto;
    Date d = new Date();

    public VFactura(Cliente cli, JTextField texto) {
        setIconImage(new ImageIcon(getClass().getResource("/img/1362798841_CellPhone.png")).getImage());
        initComponents();
        cmdAgregar.setMnemonic(KeyEvent.VK_A);
        cmdGuardar.setMnemonic(KeyEvent.VK_G);
        cmdQuitar.setMnemonic(KeyEvent.VK_Q);
        this.texto = texto;
        this.cli = cli;
        this.txtCedula.setText(cli.getCedula());
        this.txtCliente.setText(cli.getNombres() + " " + cli.getApellidos());
        this.txtTelefono.setText(cli.getTelefono());
        this.txtDireccion.setText(cli.getDireccion());
        this.txtFecha.setText(this.d.getDate() + "-" + (this.d.getMonth() + 1) + "-" + (this.d.getYear() + 1900));
        String[] identificadores = {"CANT", "DESCRIPCION", "P. UNIT", "V. VENTA"};
        this.modelo.setColumnIdentifiers(identificadores);
        this.dtgFactura.setModel(this.modelo);
        this.dtgFactura.getColumn("CANT").setPreferredWidth(30);
        this.dtgFactura.getColumn("DESCRIPCION").setPreferredWidth(330);
        this.dtgFactura.getColumn("P. UNIT").setPreferredWidth(50);
        this.dtgFactura.getColumn("V. VENTA").setPreferredWidth(50);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtCliente = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtTelefono = new javax.swing.JTextField();
        txtCedula = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtFecha = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtNumero = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtDireccion = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtGuia = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        jScrollPane1 = new javax.swing.JScrollPane();
        dtgFactura = new javax.swing.JTable();
        txtCodigo = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtPrecio = new javax.swing.JTextField();
        cmdAgregar = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        txtSubtotal = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        txtSubtotalD = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        txtIVA = new javax.swing.JTextField();
        cmdQuitar = new javax.swing.JButton();
        cmdGuardar = new javax.swing.JButton();
        txtDescuento = new javax.swing.JSpinner();
        jLabel16 = new javax.swing.JLabel();
        txtTotal = new javax.swing.JTextField();
        txtCantidad = new javax.swing.JSpinner();
        jLabel17 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        jLabel1.setText("FACTURA");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(51, 51, 51));
        jLabel3.setText("Cliente:");

        txtCliente.setEditable(false);
        txtCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtClienteActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(51, 51, 51));
        jLabel4.setText("RUC / C.I:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(51, 51, 51));
        jLabel5.setText("Telf:");

        txtTelefono.setEditable(false);

        txtCedula.setEditable(false);
        txtCedula.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCedulaActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(51, 51, 51));
        jLabel6.setText("Fecha de Emision:");

        txtFecha.setEditable(false);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(51, 51, 51));
        jLabel7.setText("Numero:");

        txtNumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNumeroActionPerformed(evt);
            }
        });
        txtNumero.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtNumeroKeyReleased(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 51, 51));
        jLabel2.setText("Direccion:");

        txtDireccion.setEditable(false);

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(51, 51, 51));
        jLabel8.setText("Guia de Remision:");

        dtgFactura.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jScrollPane1.setViewportView(dtgFactura);

        txtCodigo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCodigoKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtCodigoKeyReleased(evt);
            }
        });

        jLabel9.setText("Codigo:");

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/search-database.png"))); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel10.setText("Cantidad:");

        jLabel11.setText("P. Unit");

        txtPrecio.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtPrecioKeyReleased(evt);
            }
        });

        cmdAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/add.png"))); // NOI18N
        cmdAgregar.setText("Agregar");
        cmdAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdAgregarActionPerformed(evt);
            }
        });

        jLabel12.setText("Subtotal_0:");

        txtSubtotal.setEnabled(false);

        jLabel13.setText("Descuento:");

        jLabel14.setText("Subtotal_D:");

        txtSubtotalD.setEnabled(false);

        jLabel15.setText("IVA:");

        txtIVA.setEnabled(false);

        cmdQuitar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/delete.png"))); // NOI18N
        cmdQuitar.setText("    Quitar");
        cmdQuitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdQuitarActionPerformed(evt);
            }
        });

        cmdGuardar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        cmdGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/save.png"))); // NOI18N
        cmdGuardar.setText("     GUARDAR");
        cmdGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdGuardarActionPerformed(evt);
            }
        });

        txtDescuento.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1));
        txtDescuento.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                txtDescuentoStateChanged(evt);
            }
        });

        jLabel16.setText("Total:");

        txtTotal.setEditable(false);
        txtTotal.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        txtTotal.setForeground(new java.awt.Color(255, 0, 0));

        txtCantidad.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), Integer.valueOf(1), null, Integer.valueOf(1)));

        jLabel17.setText("%");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 572, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(390, 390, 390))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(205, 205, 205)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cmdAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 1, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cmdQuitar)
                                    .addComponent(cmdGuardar))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(txtDescuento, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                                        .addComponent(txtSubtotal)
                                        .addComponent(txtSubtotalD, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(txtIVA, javax.swing.GroupLayout.Alignment.TRAILING))
                                    .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel2))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(txtDireccion, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtCedula, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(17, 17, 17)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabel8)
                                            .addComponent(jLabel6)
                                            .addComponent(jLabel5))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(txtFecha, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtGuia, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtTelefono, javax.swing.GroupLayout.Alignment.LEADING)))
                                    .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jSeparator1))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel17)
                .addGap(29, 29, 29))
            .addGroup(layout.createSequentialGroup()
                .addGap(273, 273, 273)
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(38, 38, 38)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(txtGuia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel9)
                        .addComponent(jLabel10)
                        .addComponent(jLabel11)
                        .addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(cmdAgregar)
                        .addComponent(txtCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(txtSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmdQuitar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(txtDescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSubtotalD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(txtIVA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(cmdGuardar)))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        setSize(new java.awt.Dimension(614, 671));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void txtCedulaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCedulaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCedulaActionPerformed

    private void txtClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtClienteActionPerformed

    private void txtCodigoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == 10) {
            try {
                this.objArt = ((Articulo) this.controlArticulo.findWhere(new Articulo(), "codArticulo='" + this.txtCodigo.getText() + "'").get(0));
                this.txtPrecio.setText(String.valueOf(CNumeros.redondear(this.objArt.getPventa().doubleValue())));
            } catch (IndexOutOfBoundsException ex) {
                JOptionPane.showMessageDialog(this.rootPane, "No se encotro el articulo", "Error", 0);
            }
        }
    }//GEN-LAST:event_txtCodigoKeyPressed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        CSelecciones.texto1 = txtCodigo;
        CSelecciones.texto2 = txtPrecio;
        new VSeleccionArticulo(true).setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void cmdAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAgregarActionPerformed
        // TODO add your handling code here:
        boolean existe = false;
        String serie = "";
        if ((!this.txtCodigo.getText().equals("")) && (!this.txtPrecio.getText().equals(""))) {
            double precio = CNumeros.redondear(Double.parseDouble(this.txtPrecio.getText()) / (1.0D + configuraciones.iva / 100.0D));

            if (this.objArt != null) {
                List listaSeries = this.controladorSerie.findWhere(new Serie(), "idArticulo=" + this.objArt.getCodigo() + " and estado=0");
                if ((listaSeries == null) || (listaSeries.isEmpty())) {
                    for (int i = 0; i < this.listaDetalle.size(); i++) {
                        if (this.objArt.getCodigo().intValue() == ((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()) {
                            existe = true;
                            double nuevaCant = Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) + ((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue();
                            if (nuevaCant <= this.objArt.getStock().intValue()) {
                                ((Detallefactura) this.listaDetalle.get(i)).setCantidad(Double.valueOf(nuevaCant));
                                this.modelo.setValueAt(Double.valueOf(nuevaCant), i, 0);
                                try {
                                    this.modelo.setValueAt(Double.valueOf(nuevaCant * precio), i, 3);
                                } catch (Exception e) {
                                    JOptionPane.showMessageDialog(this.rootPane, "Campo P. Unitario Erroneo", "Error", 0);
                                    this.objArt = null;
                                    return;
                                }
                                Calcular();
                            } else {
                                JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes articulos en stock", "Error", 0);
                            }
                        }
                        if (existe) {
                            break;
                        }
                    }
                }
                if (!existe) {
                    int cant = 0;
                    int cantidadAgregar = Integer.parseInt(String.valueOf(this.txtCantidad.getValue()));
                    for (int i = 0; i < this.listaDetalle.size(); i++) {
                        if (objArt.getCodigo() == ((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()) {
                            cant = (int) (cant + ((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue());
                        }
                    }
                    double nuevaCant = Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) + cant;
                    if (nuevaCant > this.objArt.getStock().intValue()) {
                        JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes artículos en stock");
                        this.objArt = null;
                        return;
                    }
                    boolean tieneSerie = false;
                    for (int k = 0; k < cantidadAgregar; k++) {
                        if ((listaSeries != null) && (!listaSeries.isEmpty())) {
                            tieneSerie = true;
                            this.txtCantidad.setValue(Integer.valueOf(1));
                            serie = JOptionPane.showInputDialog("Ingrese el numero de serie");
                            if (serie == null) {
                                this.objArt = null;
                                return;
                            }

                            boolean existeSerie = false;
                            for (int i = 0; i < listaSeries.size(); i++) {
                                if (((Serie) listaSeries.get(i)).getNumSerie().equals(serie)) {
                                    existeSerie = true;
                                    break;
                                }
                            }
                            for (int i = 0; i < this.listaDetalle.size(); i++) {
                                if (((Detallefactura) this.listaDetalle.get(i)).getSerie().equals(serie)) {
                                    JOptionPane.showMessageDialog(this.rootPane, "Ya agrego un articulo con este numero de serie");
                                    this.objArt = null;
                                    return;
                                }

                            }

                            if (!existeSerie) {
                                JOptionPane.showMessageDialog(this.rootPane, "No existe ese numero de serie para este articulo");
                                this.objArt = null;
                                return;
                            }
                        }

                        if (Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) <= this.objArt.getStock().intValue()) {
                            String[] Articulo;
                            try {
                                String[] Articulo2 = {String.valueOf(this.txtCantidad.getValue()), this.objArt.getDescripcion() + " " + this.objArt.getMarca() + " " + this.objArt.getModelo() + " SN:" + serie, CNumeros.redondear(precio) + "", String.valueOf(CNumeros.redondear(precio * Double.parseDouble(String.valueOf(this.txtCantidad.getValue()))))};
                                Articulo = Articulo2;
                            } catch (Exception e) {
                                JOptionPane.showMessageDialog(this.rootPane, "Campo costo erroneo", "Error", 0);
                                this.objArt = null;
                                return;
                            }

                            this.modelo.addRow(Articulo);
                            Detallefactura det = new Detallefactura();
                            det.setCodigoArticulo(objArt.getCodigo());
                            det.setPrecioVenta(Double.valueOf(CNumeros.redondear(precio)));
                            det.setCantidad(Double.valueOf(Double.parseDouble(String.valueOf(this.txtCantidad.getValue()))));
                            det.setIva(Integer.valueOf(1));
                            det.setSerie(serie);
                            this.listaDetalle.add(det);
                            this.listaArticulo.add(this.objArt);
                            Calcular();
                        } else {
                            JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes articulos en stock", "Error", 0);
                        }
                        if (!tieneSerie) {
                            break;
                        }
                    }
                }
            } else {
                this.objArt = ((Articulo) this.controlArticulo.find(new Articulo(), Integer.valueOf(Integer.parseInt(this.txtCodigo.getText()))));
                if (this.objArt != null) {
                    List listaSeries = this.controladorSerie.findWhere(new Serie(), "idArticulo=" + this.objArt.getCodigo() + " and estado=0");
                    if ((listaSeries == null) || (listaSeries.isEmpty())) {
                        for (int i = 0; i < this.listaDetalle.size(); i++) {
                            if (Integer.parseInt(this.txtCodigo.getText()) == ((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()) {
                                existe = true;
                                double nuevaCant = Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) + ((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue();
                                if (nuevaCant <= this.objArt.getStock().intValue()) {
                                    ((Detallefactura) this.listaDetalle.get(i)).setCantidad(Double.valueOf(nuevaCant));
                                    this.modelo.setValueAt(Double.valueOf(nuevaCant), i, 0);
                                    try {
                                        this.modelo.setValueAt(Double.valueOf(CNumeros.redondear(nuevaCant * precio)), i, 3);
                                    } catch (Exception e) {
                                        JOptionPane.showMessageDialog(this.rootPane, "Campo P. Unitario Erroneo", "Error", 0);
                                        this.objArt = null;
                                        return;
                                    }
                                    Calcular();
                                } else {
                                    JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes articulos en stock", "Error", 0);
                                }
                            }
                            if (existe) {
                                break;
                            }
                        }
                    }
                    if (!existe) {
                        int cant = 0;
                        int cantidadAgregar = Integer.parseInt(String.valueOf(this.txtCantidad.getValue()));
                        for (int i = 0; i < this.listaDetalle.size(); i++) {
                            if (Integer.parseInt(this.txtCodigo.getText()) == ((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()) {
                                cant = (int) (cant + ((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue());
                            }
                        }
                        double nuevaCant = Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) + cant;
                        if (nuevaCant > this.objArt.getStock().intValue()) {
                            JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes artículos en stock");
                            this.objArt = null;
                            return;
                        }
                        boolean tieneSerie = false;
                        for (int k = 0; k < cantidadAgregar; k++) {
                            if ((listaSeries != null) && (!listaSeries.isEmpty())) {
                                tieneSerie = true;
                                this.txtCantidad.setValue(Integer.valueOf(1));
                                serie = JOptionPane.showInputDialog("Ingrese el numero de serie");
                                if (serie == null) {
                                    this.objArt = null;
                                    return;
                                }

                                boolean existeSerie = false;
                                for (int i = 0; i < listaSeries.size(); i++) {
                                    if (((Serie) listaSeries.get(i)).getNumSerie().equals(serie)) {
                                        existeSerie = true;
                                        break;
                                    }
                                }
                                for (int i = 0; i < this.listaDetalle.size(); i++) {
                                    if (((Detallefactura) this.listaDetalle.get(i)).getSerie().equals(serie)) {
                                        JOptionPane.showMessageDialog(this.rootPane, "Ya agrego un articulo con este numero de serie");
                                        this.objArt = null;
                                        return;
                                    }

                                }

                                if (!existeSerie) {
                                    JOptionPane.showMessageDialog(this.rootPane, "No existe ese numero de serie para este articulo");
                                    this.objArt = null;
                                    return;
                                }
                            }

                            if (Double.parseDouble(String.valueOf(this.txtCantidad.getValue())) <= this.objArt.getStock().intValue()) {
                                String[] Articulo;
                                try {
                                    String[] Articulo2 = {String.valueOf(this.txtCantidad.getValue()), this.objArt.getDescripcion() + " " + this.objArt.getMarca() + " " + this.objArt.getModelo() + " SN:" + serie, CNumeros.redondear(precio) + "", String.valueOf(CNumeros.redondear(precio * Double.parseDouble(String.valueOf(this.txtCantidad.getValue()))))};
                                    Articulo = Articulo2;
                                } catch (Exception e) {
                                    JOptionPane.showMessageDialog(this.rootPane, "Campo costo erroneo", "Error", 0);
                                    this.objArt = null;
                                    return;
                                }

                                this.modelo.addRow(Articulo);
                                Detallefactura det = new Detallefactura();
                                det.setCodigoArticulo(objArt.getCodigo());
                                det.setPrecioVenta(Double.valueOf(CNumeros.redondear(precio)));
                                det.setCantidad(Double.valueOf(Double.parseDouble(String.valueOf(this.txtCantidad.getValue()))));
                                det.setIva(Integer.valueOf(1));
                                det.setSerie(serie);
                                this.listaDetalle.add(det);
                                this.listaArticulo.add(this.objArt);
                                Calcular();
                            } else {
                                JOptionPane.showMessageDialog(this.rootPane, "No existen suficientes articulos en stock", "Error", 0);
                            }
                            if (!tieneSerie) {
                                break;
                            }
                        }
                    }
                }
            }
            this.txtCodigo.setText("");
            this.txtCantidad.setValue(Integer.valueOf(1));
            this.txtPrecio.setText("");
            this.objArt = null;
        } else {
            JOptionPane.showMessageDialog(this.rootPane, "Seleccione un articulo");
        }

    }//GEN-LAST:event_cmdAgregarActionPerformed

    private void txtDescuentoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_txtDescuentoStateChanged
        // TODO add your handling code here:
        Calcular();
    }//GEN-LAST:event_txtDescuentoStateChanged

    private void cmdQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdQuitarActionPerformed
        // TODO add your handling code here:

        if (dtgFactura.getSelectedRow() != -1) {
            if (JOptionPane.showConfirmDialog(rootPane, "Esta seguro", "Quitar Articulo", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                int i = dtgFactura.getSelectedRow();
                modelo.removeRow(i);
                listaDetalle.remove(i);
                listaArticulo.remove(i);
                Calcular();
            }

        } else {
            JOptionPane.showMessageDialog(rootPane, "Primero Seleccione un articulo", "Error", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_cmdQuitarActionPerformed

    private void cmdGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdGuardarActionPerformed
        // TODO add your handling code here:
        if (this.listaDetalle.size() > 0) {
            if (JOptionPane.showConfirmDialog(this.rootPane, "Está seguro de guardar la factura", "Guardar Factura", 1) == 0) {
                if (!this.txtNumero.getText().equals("")) {
                    Factura fact = new Factura();
                    System.out.print(this.cli.getCedula());
                    fact.setCedulaCliente(this.cli);
                    fact.setNumero(Integer.valueOf(Integer.parseInt(this.txtNumero.getText())));
                    fact.setDescuento(Double.valueOf(Double.parseDouble(String.valueOf(this.txtDescuento.getValue()))));
                    fact.setEstado("0");
                    fact.setFechaEmision(this.d);
                    fact.setIva0(Double.valueOf(0.0D));
                    fact.setIva12(Double.valueOf(Double.parseDouble(this.txtIVA.getText())));
                    fact.setSubtotal(Double.valueOf(Double.parseDouble(this.txtSubtotal.getText())));
                    fact.setTotal(Double.valueOf(Double.parseDouble(this.txtTotal.getText())));
                    fact.setDetallefacturaList(this.listaDetalle);
                    fact.setGuiaRemision(this.txtGuia.getText());
                    for (int i = 0; i < fact.getDetallefacturaList().size(); i++) {
                        ((Detallefactura) fact.getDetallefacturaList().get(i)).setNumero(fact);
                    }
                    String estado = this.controladorFactura.create(fact);
                    if (estado.equals("0")) {
                        for (int i = 0; i < this.listaDetalle.size(); i++) {
                            Articulo art1 = new Articulo();
                            art1 = (Articulo) this.controlArticulo.find(art1, Integer.valueOf(((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()));
                            art1.setStock(Integer.valueOf((int) (art1.getStock().intValue() - ((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue())));
                            try {
                                this.controlArticulo.edit(art1);
                            } catch (Exception ex) {
                                Logger.getLogger(VFactura.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                        for (int i = 0; i < this.listaDetalle.size(); i++) {
                            Articulo art1 = new Articulo();
                            art1 = (Articulo) this.controlArticulo.find(art1, Integer.valueOf(((Detallefactura) this.listaDetalle.get(i)).getCodigoArticulo()));
                            try {
                                Serie serie = (Serie) this.controladorSerie.findWhere(new Serie(), "idArticulo=" + art1.getCodigo() + " and numSerie='" + ((Detallefactura) this.listaDetalle.get(i)).getSerie() + "'").get(0);
                                serie.setEstado(Integer.valueOf(1));
                                try {
                                    this.controladorSerie.edit(serie);
                                } catch (Exception ex) {
                                    Logger.getLogger(VFactura.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            } catch (Exception e) {
                            }
                        }
                        GenericController contIg = new GenericController();
                        Ingreso ingreso = new Ingreso();
                        ingreso.setIdUsuario(configuraciones.usuario);
                        ingreso.setFecha(this.d);
                        ingreso.setConcepto("Venta");
                        ingreso.setValor(fact.getTotal());
                        ingreso.setHora(this.d.getHours() + ":" + this.d.getMinutes());
                        contIg.create(ingreso);
                        GenericController controladorDiario = new GenericController();
                        String fecha = this.d.getYear() + 1900 + "-" + (this.d.getMonth() + 1) + "-" + this.d.getDate();
                        List diarios = controladorDiario.findWhere(new Diario(), "fecha='" + fecha + "' and idUsuario='" + configuraciones.usuario.getNick() + "'");
                        Diario diario = (Diario) diarios.get(0);
                        diario.setValor(Double.valueOf(diario.getValor().doubleValue() + fact.getTotal().doubleValue()));
                        try {
                            controladorDiario.edit(diario);
                        } catch (Exception ex) {
                            Logger.getLogger(VFactura.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        VMantenimientoArticulos.getInstance().actualizaStocks();
                        if (JOptionPane.showConfirmDialog(this.rootPane, "Guardado Correctamente\nDesea Imprimir la Factura?", "Guardar Factura", 0) == 0) {
                            new CImprimir().imprimirFactura(fact, this.listaArticulo, configuraciones.impresoraFacturas);
                            configuraciones.saldocaja = CNumeros.redondear(configuraciones.saldocaja + fact.getTotal().doubleValue());
                            this.texto.setText(configuraciones.saldocaja + "");
                            dispose();
                        } else {
                            configuraciones.saldocaja = CNumeros.redondear(configuraciones.saldocaja + fact.getTotal().doubleValue());
                            this.texto.setText(configuraciones.saldocaja + "");
                            dispose();
                        }
                    } else if (estado.equals("1")) {
                        JOptionPane.showMessageDialog(this.rootPane, "Ya existe una Factura con este numero", "Error", 0);
                    } else {
                        JOptionPane.showMessageDialog(this.rootPane, "Error al guardar la factura", "Error", 0);
                    }
                } else {
                    JOptionPane.showMessageDialog(this.rootPane, "Ingrese un Numero de Factura", "Error", 0);
                }
            }
        } else {
            JOptionPane.showMessageDialog(this.rootPane, "No se han agregado articulos a la factura", "Error", 0);
        }

    }//GEN-LAST:event_cmdGuardarActionPerformed

    private void txtNumeroKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumeroKeyReleased
        // TODO add your handling code here:
        Validacion validar = new Validacion();
        validar.numeros(evt, txtNumero);
    }//GEN-LAST:event_txtNumeroKeyReleased

    private void txtCodigoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCodigoKeyReleased

    private void txtPrecioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPrecioKeyReleased
        // TODO add your handling code here:
        Validacion validar = new Validacion();
        validar.decimal(evt, txtPrecio);
    }//GEN-LAST:event_txtPrecioKeyReleased

    private void txtNumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNumeroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNumeroActionPerformed

    /**
     * @param args the command line arguments
     */
    private void Calcular() {
        double subtotal = 0.0D;
        double iva = 0.0D;
        double desc = Double.parseDouble(String.valueOf(this.txtDescuento.getValue()));
        for (int i = 0; i < this.listaDetalle.size(); i++) {
            subtotal += CNumeros.redondear(((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue() * ((Detallefactura) this.listaDetalle.get(i)).getPrecioVenta().doubleValue());

            double sd = CNumeros.redondear(((Detallefactura) this.listaDetalle.get(i)).getCantidad().doubleValue() * ((Detallefactura) this.listaDetalle.get(i)).getPrecioVenta().doubleValue());
            sd = CNumeros.redondear(sd - sd * desc / 100.0D);
            iva += CNumeros.redondear(sd * configuraciones.iva / 100.0D);
        }

        double subtd = CNumeros.redondear(subtotal - subtotal * desc / 100.0D);
        double total = CNumeros.redondear(subtd + iva);
        this.txtSubtotal.setText(String.valueOf(CNumeros.redondear(subtotal)));
        this.txtSubtotalD.setText(String.valueOf(CNumeros.redondear(subtd)));
        this.txtIVA.setText(String.valueOf(CNumeros.redondear(iva)));
        this.txtTotal.setText(String.valueOf(CNumeros.redondear(total)));
    }

   
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VFactura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VFactura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VFactura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VFactura.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            System.out.println("Error setting native LAF: " + e);
        }
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VFactura(new Cliente(), new JTextField()).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cmdAgregar;
    private javax.swing.JButton cmdGuardar;
    private javax.swing.JButton cmdQuitar;
    private javax.swing.JTable dtgFactura;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSpinner txtCantidad;
    private javax.swing.JTextField txtCedula;
    private javax.swing.JTextField txtCliente;
    private javax.swing.JTextField txtCodigo;
    private javax.swing.JSpinner txtDescuento;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtFecha;
    private javax.swing.JTextField txtGuia;
    private javax.swing.JTextField txtIVA;
    private javax.swing.JTextField txtNumero;
    private javax.swing.JTextField txtPrecio;
    private javax.swing.JTextField txtSubtotal;
    private javax.swing.JTextField txtSubtotalD;
    private javax.swing.JTextField txtTelefono;
    private javax.swing.JTextField txtTotal;
    // End of variables declaration//GEN-END:variables
}
